﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebUI.DAL;
using WebUI.BL.Contact;
using WebUI.Lang;

namespace WebUI
{
    public partial class Contact : AdlerBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Btn_Click(object sender, EventArgs e)
        {
            var contactNew = new tbl_Contact();
            contactNew.Subject = txtSubject.Text;
            contactNew.Containt = txtContain.Text;
            contactNew.Status = "NORMAL";
            contactNew.CreatedOn = DateTime.Now;
            contactNew.CreatedUser = "Son";//Request.Cookies[GetMemBerLoginName()].value;
            ContactBL repository=new ContactBL();
            try
            {
                repository.Insert(contactNew);
                txtmessage.Text = "Gửi thành công!!!";
                ClearControl();
            }
            catch (Exception)
            {
                
                throw;
            }
        }

        private void ClearControl()
        {
            txtContain.Text = "";
            txtSubject.Text = "";
        }
    }
}